﻿using Algorithms.Expressions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Linq.Expressions;

namespace GeneticAlgorithmTests
{
    [TestClass]
    public class ManualExpressionTreeEvaluatorTest
    {
        /// <summary>
        ///A test for Evaluate
        ///</summary>
        [TestMethod]
        public void EvaluateTest()
        {
            ManualExpressionTreeEvaluator target = new ManualExpressionTreeEvaluator(); // TODO: Initialize to an appropriate value
            Expression tree = Expression.Multiply(Expression.Add(Expression.Constant(1d), Expression.Parameter(typeof(double))),
                                                  Expression.Divide(Expression.Parameter(typeof(double)), Expression.Constant(2d)));
            double input = 2; // TODO: Initialize to an appropriate value
            double expected = 3F; // TODO: Initialize to an appropriate value
            double actual;
            actual = target.Evaluate(tree, input);
            Assert.AreEqual(expected, actual);
        }
    }
}
